From 1f5c461064ccf009114326848f1a8f5ae259768c Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Sun, 18 Dec 2016 16:38:00 -0700 Subject: [PATCH] Fix bug in height filter pointed out by Valerio Messina. height corrections should not be applied if the altitude is unknown. --- height.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/height.cc b/height.cc index f03e6e7ab..963cae681 100644 --- a/height.cc +++ b/height.cc @@ -109,12 +109,14 @@ correct_height(const Waypoint* wpt) { Waypoint* waypointp = (Waypoint*) wpt; - if (addopt) { - waypointp->altitude += addf; - } - - if (wgs84tomslopt) { - waypointp->altitude -= wgs84_separation(waypointp->latitude, waypointp->longitude); + if (waypointp->altitude != unknown_alt) { + if (addopt) { + waypointp->altitude += addf; + } + + if (wgs84tomslopt) { + waypointp->altitude -= wgs84_separation(waypointp->latitude, waypointp->longitude); + } } } -- 2.30.2